package com.study.component;

import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.study.dto.User;
import com.study.dto.User2;
import com.study.service.UserService;
import java.util.List;
import javax.annotation.Resource;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @Author tanglingyu
 * @Date: 2021/04/08/ 21:45
 * @Description
 */
@Component
@AllArgsConstructor
public class Query1 implements GraphQLQueryResolver {

  @Resource
  private UserService userService;

  public List<User> getUser2(String name) {
    return userService.findUserByName(name);
  }

  public User2 getUser4(String name) {
    User user = new User();
    user.setName("123456");
    user.setId(100);
    User2 user2 = new User2();
    user2.setSb("sb");
    user2.setUser(user);
    return user2;
  }
}
